import { checkVersion } from '@/utils/utils';
import 'intl';
import 'intl/locale-data/jsonp/en';

export const dva = {
  config: {
    onError(e) {
      e.preventDefault();
      console.log(e.message);
    }
  },
}

export function render(oldRender) {
  if (process.env.ENV === 'prod') {
    require('./utils/baidu');
  }
  oldRender();
}

export function onRouteChange({ location, routes, action }) {
  // 路由切换时,将页面滚动至顶部,而非之前页面的位置
  window.scrollTo(0,0)
  checkVersion();
}
